﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Data;

namespace MODASA.HojaDefinicionProducto
{
    public partial class HDPComponentesElectricos : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["HDP"] == null)
            {
                Page.Response.Redirect("HDPModelos.aspx");

            }  
        }

        protected void RBLMONINS_SelectedIndexChanged(object sender, EventArgs e)
        {
            HabilitarDesabilitarMonitores(RBLMONINS.Text);
        }

        private void HabilitarDesabilitarMonitores(string res) {

            if (res == "NO")
            {
                RBLMONTIP.Enabled = false;
                RBLMONCAN1N.Enabled = false;
                RBLMONCAN2N.Enabled = false;
                HLMONITORES.Visible = false;
                CBMONSOLPRE.Enabled = true;
            }
            else {
                CBMONSOLPRE.Enabled = false;
                RBLMONTIP.Enabled = true;
                RBLMONCAN1N.Enabled = true;
                RBLMONCAN2N.Enabled = true;
                HLMONITORES.Visible = true;
                HLMONITORES.ImageUrl = "../images/Buses/ImgInt/ComponentesElectricos/m_Monitores.jpg";
                HLMONITORES.NavigateUrl = "../images/Buses/ImgInt/ComponentesElectricos/Monitores.jpg"; 
                

            }
        }

        protected void RBLRADINS_SelectedIndexChanged(object sender, EventArgs e)
        {
            HabilitarDesabilitarRadio(RBLRADINS.Text);
        }
        private void HabilitarDesabilitarRadio(string res) {
            if (res == "NO")
            {
                CBLRADUBI.Enabled = false;
            }
            else {
                CBLRADUBI.Enabled = true;
            }
        }


        protected void RBLSISENTREINS_SelectedIndexChanged(object sender, EventArgs e)
        {
            HabilitarDesabilitarSistemaEntre(RBLSISENTREINS.Text);
        }
        private void HabilitarDesabilitarSistemaEntre(string res)
        {
            if (res == "NO") {
                RBLSISENTRUBI.Enabled = false;
            }
            else if (res == "SI") {
                RBLSISENTRUBI.Enabled = true;
            }
        }

        protected void RBLINDINS_SelectedIndexChanged(object sender, EventArgs e)
        {
            HabilitarDesabilitarIndicadores(RBLINDINS.Text);
        }

        private void HabilitarDesabilitarIndicadores(string res) {

            if (res == "NO")
            {
                RBLINDMAR.Enabled = false;
            }
            else if (res=="SI") {
                RBLINDMAR.Enabled = true;
            }

        }

        protected void RBLENCINS_SelectedIndexChanged(object sender, EventArgs e)
        {
            HabilitarDesabilitarEnchufes(RBLENCINS.Text);
        }

        private void HabilitarDesabilitarEnchufes(string res) {

            if (res == "NO") {
                CBLENCMAR.Enabled = false;
            }
            else if (res == "SI") {
                CBLENCMAR.Enabled = true;
            }
        }

        protected void RBLLIMP2N_SelectedIndexChanged(object sender, EventArgs e)
        {
            CargarImgLimpiaParabrisas(RBLLIMP2N.Text);
        }

        private void CargarImgLimpiaParabrisas(string res) {
            if (res == "SI")
            {
                HLLIMPIAPARA.Visible = true;
                HLLIMPIAPARA.ImageUrl = "../images/Buses/ImgInt/ComponentesElectricos/m_LimpiaParabrisas.png";
                HLLIMPIAPARA.NavigateUrl = "../images/Buses/ImgInt/ComponentesElectricos/LimpiaParabrisas.png";
            }
            else {
                HLLIMPIAPARA.Visible = false;
            }
        
        }

        protected void RBLLETREINS_SelectedIndexChanged(object sender, EventArgs e)
        {
            CargarImgLetreroRuta(RBLLETREINS.Text);
        }

        private void CargarImgLetreroRuta(string res)
        {
            if (res == "SI")
            {
                HLLETRERORUTA.Visible = true;
                HLLETRERORUTA.ImageUrl = "../images/Buses/ImgInt/ComponentesElectricos/m_LetreroRuta.png";
                HLLETRERORUTA.NavigateUrl = "../images/Buses/ImgInt/ComponentesElectricos/LetreroRuta.png";
            }
            else
            {
                HLLIMPIAPARA.Visible = false;
            }

        }

    }
}